import { getWaitCheckCancelOrder } from '@/api/order'
import { ref } from 'vue'
import { WaitCheckCancelOrderInfo } from '@/components/pages/order/detail/CheckCancelOrder/types'

// 加载
const loading = ref(false)

// 根据工单ID获取待审核取消工单信息
const info = ref<WaitCheckCancelOrderInfo | null>(null)

/**
 * 根据工单ID获取待审核取消工单信息
 * @param {string} id - 工单id
 */
const getInfo = async (id: string) => {
  loading.value = true
  const res = await getWaitCheckCancelOrder(id)
  info.value = res.data.data.row
  loading.value = false
}

export default {
  loading,
  info,
  getInfo,
}
